import axios from "axios";
import { api_urls } from "./urls";

export const contract_api = {
    deleteContract(id) {
        return axios.post(api_urls.contract.delete, { id: id })
    },
    pageContract(contractReq) {
        return axios.post(api_urls.contract.page, contractReq)
    },
    updateContract(contract) {
        return axios.post(api_urls.contract.update, { ...contract, parent_no: contract.parent_no === '' ? null : contract.parent_no })
    },
    createContract(contract) {
        return axios.post(api_urls.contract.create, { ...contract, id: 0 })
    }
}

export const CONTRACT_TYPE = {
    MAIN: 0,
    SUB: 1
}